//
//  doctorMeansCell.m
//  7-11快医
//
//  Created by amor on 16/7/12.
//  Copyright © 2016年 amor. All rights reserved.
//

#import "CJTDoctorMeansCell.h"
#import "CJTModel.h"
#import <UIImageView+WebCache.h>

@interface CJTDoctorMeansCell ()
@property (weak, nonatomic) IBOutlet UILabel *doctorName;
@property (weak, nonatomic) IBOutlet UILabel *hospitalName;
@property (weak, nonatomic) IBOutlet UIButton *orderButton;
@property (weak, nonatomic) IBOutlet UIButton *flowerButton;
@property (weak, nonatomic) IBOutlet UIButton *flagButton;
@property (weak, nonatomic) IBOutlet UILabel *positionLabel;
@property (weak, nonatomic) IBOutlet UIButton *otherButton;
@property (weak, nonatomic) IBOutlet UIImageView *doctorImage;


@end

@implementation CJTDoctorMeansCell

- (void)awakeFromNib {
   
}

+ (instancetype)doctorMeansCellWithTableView:(UITableView *)tableView reuseIdentifier:(NSString *)reuseIdentifier indexPath:(NSIndexPath *) indexPath{
    
    CJTDoctorMeansCell *cell = [tableView cellForRowAtIndexPath:indexPath];
    if (!cell) {
        
        cell = [tableView dequeueReusableCellWithIdentifier:reuseIdentifier forIndexPath:indexPath];
    }
    return cell;
}

//-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
//    
//    if(self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
//
//        UINib *nib = [UINib nibWithNibName:@"conditionCell" bundle:nil];
//        self = [[NSBundle mainBundle] loadNibNamed:@"conditionCell" owner:nil options:nil].lastObject;
//    }
//    
//    return self;
//}

-(void)setModels:(Esarray *)models
{
    _models = models;
    
    [self.doctorImage sd_setImageWithURL:[NSURL URLWithString:models.doctor_portrait] placeholderImage:[UIImage imageNamed:@"illness_img_person.png"] options:SDWebImageRetryFailed];
    self.doctorImage.layer.masksToBounds = YES;
    self.doctorImage.layer.cornerRadius = 45;
    self.doctorName.text = models.doctor_name;
    self.positionLabel.text = models.doctor_title_name;
    self.hospitalName.text = models.doctor_hospital_name;
    
    [self.flowerButton setTitle:[NSString stringWithFormat:@"  %ld",(long)models.flower] forState:UIControlStateNormal];
    [self.orderButton setTitle:[NSString stringWithFormat:@"  %ld",(long)models.banner] forState:UIControlStateNormal];
    [self.flagButton setTitle:[NSString stringWithFormat:@"  %ld",(long)models.operation_count] forState:UIControlStateNormal];
    self.otherButton.titleLabel.lineBreakMode = 0;
    [self.otherButton setTitle:[NSString stringWithFormat:@"匹配度\n  98%%"] forState:UIControlStateNormal];
    
}
@end
